<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>状态栏的分解显示文本特效</title>
    <script type="text/javascript" language="JavaScript">
        let str=""
        let direction="left"        //文字移动的方向
        function craAry(n)
        {
            for (let i = 0; i < n; i++) {this[i] = 0}//初始化数组
            return this
        }
        let js_mult1=3141
        let js_mult2=5821
        let js_m1=100000000
        let js_m2=10000
        let js_iseed=0
        let js_iseed1=0
        let js_iseed2=0

        function ArrayRandom(n)              //获取一个随机数
        {
            if (js_iseed === 0)
            {
                now = new Date()
                js_iseed = now.getHours() + now.getMinutes() * 60
                    + now.getSeconds() * 3600
            }
            js_iseed1 = js_iseed / js_m2
            js_iseed2 = js_iseed % js_m2
            let tmp = (((js_iseed2 * js_mult1 + js_iseed1 * js_mult2) % js_m2) *
                js_m2 + (js_iseed2 * js_mult2)) % js_m1
            js_iseed = (tmp + 1) % js_m1
            return (Math.floor((js_iseed/js_m1) * n))
        }

        msgArray = craAry(5)               //初始化要显示的文本信息
        msgArray[0] = "北京奥运会欢迎您的参与"
        msgArray[1] = "上海世博会欢迎您的参与"
        msgArray[2] = "为奥运会作贡献"
        msgArray[3] = "为世博会作贡献"
        msgArray[4] = "当一个合格的志愿者";
        msg = ""
        dmsg = ""

        function viewMsg()
        {
            if (msg === dmsg)
            {
                msg = msgArray[ArrayRandom(5)]               //获取数组中的一段随机文本
                dmsg = ""
                for (let ii = 0; ii < msg.length; ii++) dmsg += " "
                viewtime = window.setTimeout('viewMsg()',100)
                return true
            }
            let ii = ArrayRandom(msg.length)
            let astr = dmsg.substring(0, ii)            //间隔式的截取显示文本中的字符
            let bstr = msg.substring(ii, ii+1)
            let cstr = dmsg.substring(ii+1, dmsg.length)
            dmsg = astr+bstr+cstr
            window.status = dmsg                        //状态栏中显示文本信息
            viewtime = window.setTimeout('viewMsg()',50)//循环显示状态栏中的信息
            return true
        }
        
    </script>
</head>
<body bgcolor="#fef4d9" onload="viewtime = window.setTimeout('viewMsg()',500);">

</body>
</html>